Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added "canasta elasticsearch index" command #76

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

chl178
Copy link
Contributor

@chl178 chl178 commented Mar 27, 2023

Fixes #41

Summary

This PR adds the canasta elasticsearch index command to the Canasta CLI, which allows users to easily initialize the search index for a Canasta instance. This new command will make it more convenient for users to set up and manage the Elasticsearch indices and clusters associated with their Canasta installations.

Changes

Create a new elasticsearch package for managing Elasticsearch indices and clusters for Canasta.
Add indexCmdCreate() function in the elasticsearch package to create a new Cobra command for initializing the search index for a Canasta instance.
Add initializeIndex() function in the elasticsearch package to perform the actual index initialization process.
Add NewCmdCreate() function in the elasticsearch package to create a new Cobra command for managing Elasticsearch.
Update the root CLI command to include the new elasticsearch package and its commands.

Test

Test the new command by following these steps:

Check out this branch and build the CLI tool.
Use an existing Canasta instance
Run the canasta elasticsearch index command with the appropriate flags
Verify that the search index initialization process completes successfully and the Elasticsearch indices and clusters are configured correctly.
Screenshot from 2023-03-26 20-07-56

Please let me know if you have any questions or concerns about the changes in this PR.

@chl178
Copy link
Contributor Author

chl178 commented Mar 27, 2023

@jeffw16 @yaronkoren I have already submitted 3 Pull Requests related to the CLI, and I would like to try tackling Canasta issues. However, all the Canasta issues in #219 have been assigned. Can I choose an issue that is not listed in #219?

@jeffw16
Copy link
Member

jeffw16 commented Mar 27, 2023

@chl178 Can you try CanastaWiki/Canasta#223?

Basically, it would be doing CanastaWiki/Canasta#218 except refactor almost all of the run-apache.sh script into a maintenance-scripts folder. It should resemble the Taqasta implementation, except the scripts should be in the maintenance-scripts folder, which should be located within _sources/scripts: https://github.com/WikiTeq/Taqasta/tree/master/_sources/scripts

@yaronkoren
Copy link
Member

@chl178 - this looks great! And well-documented. It certainly looks correct; hopefully someone can test it soon.

Yes, @jeffw16 is right that adding that maintenance-scripts/ directory would be a great next task, if you want to do another one. Although I have a correction: it wouldn't be that much of the run-apache.sh script that has to get refactored. Also, I'm not sure that looking at the Taqasta code would help that much (maybe it would, I don't know). If you follow the explanation in the task description, you should be fine. Although of course let us know if you have questions.

@chl178
Copy link
Contributor Author

chl178 commented Mar 27, 2023

@jeffw16 @yaronkoren Thank you for your suggestions, I would like to try #223.

@jeffw16
Copy link
Member

jeffw16 commented Mar 27, 2023

Go for it

func initializeIndex(instance config.Installation) {
fmt.Println("Running search index initialization process...")
orchestrators.Exec(instance.Path, instance.Orchestrator, "web", "php extensions/CirrusSearch/maintenance/UpdateSearchIndexConfig.php --startOver")
orchestrators.Exec(instance.Path, instance.Orchestrator, "web", "php extensions/CirrusSearch/maintenance/ForceSearchIndex.php --skipLinks --indexOnSkip")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CirrusSearch README states that before running the scripts, it's necessary to enable $wgDisableSearchUpdate flag and then disable it back once all the operations are completed

Frankly, I did not notice any issues running the scripts with the flag kept disabled, but it still may worth to be considered

@yaronkoren
Copy link
Member

yaronkoren commented Feb 1, 2024

@vedmaka - @jeffw16 and I were just talking about this PR. Neither of us could remember why these three scripts need to be called in this specific order (if they do). I know that it's been almost a year, but - do you know the reason for this order, if there is one?

Oops, I put this comment in the wrong PR! Please ignore this one.

@vedmaka
Copy link

vedmaka commented Feb 9, 2024

@yaronkoren so the question is for some other PR, right? not related to ElasticSearch?

@yaronkoren
Copy link
Member

That's right - it was actually for CanastaWiki/Canasta#269 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

Add "canasta elasticsearch index" command
4 participants